package action;

import java.util.List;

import model.Knowledge;
import model.User;
import action.base.BaseAction;

import com.opensymphony.xwork2.ActionContext;

public class SelfGetKnowledge extends BaseAction {
	private User user;
	private Knowledge knowledge;
	public Knowledge getKnowledge() {
		return knowledge;
	}
	public void setKnowledge(Knowledge knowledge) {
		this.knowledge = knowledge;
	}
	public String execute() throws Exception{
		ActionContext ctx = ActionContext.getContext();
		user = (User)ctx.getSession().get("USER");
		List<Knowledge> k = mgk.getKnowledgeByUser(user);
		if(k.size()>0){
			ctx.getSession().put("K", k);
			return "input";
		}else{
			return "input";
		}
	}
}
